﻿using System;
using System.Net.NetworkInformation;

namespace Glorysoft.EAP.EAPClient.Common
{
    public class DataService : IDataService
    {
        public void GetData(Action<DataItem, Exception> callback)
        {
            // Use this to connect to the actual data service
            var item = new DataItem("Welcome to MVVM Light");
            callback(item, null);
        }

        public static bool TestNetConnectity(string strIP, int WaitSecond = 200)
        {
            try
            {
                Ping pingSender = new Ping();
                int timeout = WaitSecond;
                PingReply reply = pingSender.Send(strIP, timeout);
                return (reply.Status == IPStatus.Success);
            }
            catch (Exception ex)
            {
                return false;
            }
        }
    }
}